#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<vector>
using namespace std;

class Solution {
public:
    void moveZeroes(vector<int>& nums) {
        /*int dest = -1;
        int cur = 0;
        while (cur < nums.size())
        {
            if (nums[cur] == 0)
                ++cur;
            else
            {
                int tmp = nums[dest + 1];
                nums[++dest] = nums[cur];
                nums[cur] = tmp;
                ++cur;
            }
        }*/

        for (int dest = -1, cur = 0; cur < nums.size(); ++cur)
        {
            if (nums[cur] != 0)
            {
                swap(nums[++dest], nums[cur]);
            }
        }
    }
};